package org.bitbrushers.jobextractor.net;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.ContentHandler;
import java.net.URLConnection;


public class HtmlContentHandler extends ContentHandler {


	public Object getContent(URLConnection urlConn) throws IOException {
		InputStream c = null;
		BufferedReader httpReader = null;
		StringBuffer pageContent = new StringBuffer();

		try {
			c = urlConn.getInputStream();
			httpReader = new BufferedReader(new InputStreamReader(c));
			int ch;
			while ((ch = httpReader.read()) != -1) {
				 pageContent.append((char)ch);
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			httpReader.close();
		}
		return pageContent.toString();


	}

}
